<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>axiethernet: xaxiethernet_example_polled.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">axiethernet
   </div>
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',false,false,'search.php','Search');
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xaxiethernet__example__polled_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xaxiethernet_example_polled.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>Implements examples that utilize the Axi Ethernet's FIFO direct frame transfer mode in a polled fashion to send and receive frames. </p>
<p>These examples demonstrate:</p>
<ul>
<li>How to perform simple polling send and receive.</li>
<li>Advanced frame processing</li>
<li>Error handling</li>
</ul>
<p>Functional guide to example:</p>
<ul>
<li><a class="el" href="xaxiethernet__example__polled_8c.html#afca56032499429904944d2fc83975c9f" title="This function demonstrates the usage of the Axi Ethernet by sending and receiving a single frame in p...">AxiEthernetSingleFramePolledExample()</a> demonstrates the simplest way to send and receive frames in polled mode.</li>
<li><a class="el" href="xaxiethernet__example__polled_8c.html#a0cd46e4b00a48a4968d08e1158a666b2" title="This example uses polled mode to queue up multiple frames in the packet FIFOs before sending them in ...">AxiEthernetMultipleFramesPolledExample()</a> demonstrates how to transmit a "burst" of frames by queueing up several in the packet FIFO prior to transmission.</li>
<li><a class="el" href="xaxiethernet__example__polled_8c.html#af885695f4f3be3dc928f62e466725fb1" title="This functions polls the Tx status and waits for an indication that a frame has been transmitted succ...">AxiEthernetPollForTxStatus()</a> demonstrates how to poll for transmit complete status and how to handle error conditions.</li>
<li><a class="el" href="xaxiethernet__example__polled_8c.html#ad883d4f3debe88fe75096a79b5cdc069" title="This functions polls the Rx status and waits for an indication that a frame has arrived or a receive ...">AxiEthernetPollForRxStatus()</a> demonstrates how to poll for receive status and how to handle error conditions.</li>
<li><a class="el" href="xaxiethernet__example__polled_8c.html#a56e626d72ffba0a50d6c992df0f5eb6a" title="This function resets the device but preserves the options set by the user. ">AxiEthernetResetDevice()</a> demonstrates how to reset the driver/HW without losing all configuration settings.</li>
</ul>
<p>Note that the advanced frame processing algorithms shown here are not limited to polled mode operation. The same techniques can be used for FIFO direct interrupt driven mode as well.</p>
<pre>
MODIFICATION HISTORY:</pre><pre>Ver   Who  Date     Changes
<hr/>

1.00a asa  4/30/10 First release based on the ll temac driver
5.4   ms   01/23/17 Modified xil_printf statement in main function to
                    ensure that "Successfully ran" and "Failed" strings are
                    available in all examples. This is a fix for CR-965028.</pre><pre></pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a827aa292a20f9a15e68bfe60e82cfc13"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxiethernet__example__polled_8c.html#a827aa292a20f9a15e68bfe60e82cfc13">AxiEthernetPolledExample</a> (u16 AxiEthernetDeviceId, u16 FifoDeviceId)</td></tr>
<tr class="memdesc:a827aa292a20f9a15e68bfe60e82cfc13"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function demonstrates the usage of the Axi Ethernet by sending and receiving frames in polled mode.  <a href="#a827aa292a20f9a15e68bfe60e82cfc13">More...</a><br /></td></tr>
<tr class="separator:a827aa292a20f9a15e68bfe60e82cfc13"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afca56032499429904944d2fc83975c9f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxiethernet__example__polled_8c.html#afca56032499429904944d2fc83975c9f">AxiEthernetSingleFramePolledExample</a> (void)</td></tr>
<tr class="memdesc:afca56032499429904944d2fc83975c9f"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function demonstrates the usage of the Axi Ethernet by sending and receiving a single frame in polled mode.  <a href="#afca56032499429904944d2fc83975c9f">More...</a><br /></td></tr>
<tr class="separator:afca56032499429904944d2fc83975c9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0cd46e4b00a48a4968d08e1158a666b2"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxiethernet__example__polled_8c.html#a0cd46e4b00a48a4968d08e1158a666b2">AxiEthernetMultipleFramesPolledExample</a> (void)</td></tr>
<tr class="memdesc:a0cd46e4b00a48a4968d08e1158a666b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">This example uses polled mode to queue up multiple frames in the packet FIFOs before sending them in a single burst.  <a href="#a0cd46e4b00a48a4968d08e1158a666b2">More...</a><br /></td></tr>
<tr class="separator:a0cd46e4b00a48a4968d08e1158a666b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af885695f4f3be3dc928f62e466725fb1"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxiethernet__example__polled_8c.html#af885695f4f3be3dc928f62e466725fb1">AxiEthernetPollForTxStatus</a> (void)</td></tr>
<tr class="memdesc:af885695f4f3be3dc928f62e466725fb1"><td class="mdescLeft">&#160;</td><td class="mdescRight">This functions polls the Tx status and waits for an indication that a frame has been transmitted successfully or a transmit related error has occurred.  <a href="#af885695f4f3be3dc928f62e466725fb1">More...</a><br /></td></tr>
<tr class="separator:af885695f4f3be3dc928f62e466725fb1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad883d4f3debe88fe75096a79b5cdc069"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxiethernet__example__polled_8c.html#ad883d4f3debe88fe75096a79b5cdc069">AxiEthernetPollForRxStatus</a> (void)</td></tr>
<tr class="memdesc:ad883d4f3debe88fe75096a79b5cdc069"><td class="mdescLeft">&#160;</td><td class="mdescRight">This functions polls the Rx status and waits for an indication that a frame has arrived or a receive related error has occurred.  <a href="#ad883d4f3debe88fe75096a79b5cdc069">More...</a><br /></td></tr>
<tr class="separator:ad883d4f3debe88fe75096a79b5cdc069"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a56e626d72ffba0a50d6c992df0f5eb6a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxiethernet__example__polled_8c.html#a56e626d72ffba0a50d6c992df0f5eb6a">AxiEthernetResetDevice</a> (void)</td></tr>
<tr class="memdesc:a56e626d72ffba0a50d6c992df0f5eb6a"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function resets the device but preserves the options set by the user.  <a href="#a56e626d72ffba0a50d6c992df0f5eb6a">More...</a><br /></td></tr>
<tr class="separator:a56e626d72ffba0a50d6c992df0f5eb6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xaxiethernet__example__polled_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">This is the main function for the AxiEthernet example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br /></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a0cd46e4b00a48a4968d08e1158a666b2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0cd46e4b00a48a4968d08e1158a666b2">&#9670;&nbsp;</a></span>AxiEthernetMultipleFramesPolledExample()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int AxiEthernetMultipleFramesPolledExample </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This example uses polled mode to queue up multiple frames in the packet FIFOs before sending them in a single burst. </p>
<p>Receive packets are handled in a similar way.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>-XST_SUCCESS to indicate success -XST_FAILURE to indicate failure</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">References <a class="el" href="group__axiethernet__v5__0.html#ga2cfa48d42e55238f6f30aff6d658e4fe">XAxiEthernet_Start()</a>.</p>

</div>
</div>
<a id="a827aa292a20f9a15e68bfe60e82cfc13"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a827aa292a20f9a15e68bfe60e82cfc13">&#9670;&nbsp;</a></span>AxiEthernetPolledExample()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int AxiEthernetPolledExample </td>
          <td>(</td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>AxiEthernetDeviceId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>FifoDeviceId</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function demonstrates the usage of the Axi Ethernet by sending and receiving frames in polled mode. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">AxiEthernetDeviceId</td><td>is device ID of the AxiEthernet Device , typically XPAR_&lt;AXIETHERNET_instance&gt;_DEVICE_ID value from xparameters.h </td></tr>
    <tr><td class="paramname">FifoDeviceId</td><td>is device ID of the Fifo device taken from xparameters.h</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>-XST_SUCCESS to indicate success -XST_FAILURE to indicate failure</dd></dl>
<dl class="section note"><dt>Note</dt><dd>AxiFifo hardware must be initialized before initializing AxiEthernet. Since AxiFifo reset line is connected to the AxiEthernet reset line, a reset of AxiFifo hardware during its initialization would reset AxiEthernet. </dd></dl>

<p class="reference">References <a class="el" href="struct_x_axi_ethernet___config.html#a58df9c31ad87109bd294fb26a8af9630">XAxiEthernet_Config::AxiDevType</a>, <a class="el" href="xaxiethernet__example_8h.html#ad700d3b9e292277d5437ecc4dc304dc3">AxiEthernetUtilErrorTrap()</a>, and <a class="el" href="group__axiethernet__v5__0.html#ga781a4d89a7a3a9d59ac8921ba66b353d">XAxiEthernet_LookupConfig()</a>.</p>

<p class="reference">Referenced by <a class="el" href="xaxiethernet__example__polled_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
<a id="ad883d4f3debe88fe75096a79b5cdc069"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad883d4f3debe88fe75096a79b5cdc069">&#9670;&nbsp;</a></span>AxiEthernetPollForRxStatus()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int AxiEthernetPollForRxStatus </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This functions polls the Rx status and waits for an indication that a frame has arrived or a receive related error has occurred. </p>
<p>If an error is reported, handle all the possible error conditions.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>- XST_SUCCESS, a frame has been received<ul>
<li>XST_NO_DATA, Timeout. Rx failure.</li>
<li>XST_FIFO_ERROR, Error in the FIFO.</li>
<li>XST_DATA_LOST, a frame has been dropped</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a id="af885695f4f3be3dc928f62e466725fb1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af885695f4f3be3dc928f62e466725fb1">&#9670;&nbsp;</a></span>AxiEthernetPollForTxStatus()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int AxiEthernetPollForTxStatus </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This functions polls the Tx status and waits for an indication that a frame has been transmitted successfully or a transmit related error has occurred. </p>
<p>If an error is reported, it handles all the possible error conditions.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>- XST_SUCCESS, Tx has completed<ul>
<li>XST_NO_DATA, Timeout. Tx failure.</li>
<li>XST_FIFO_ERROR, Error in the FIFO.</li>
</ul>
</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

</div>
</div>
<a id="a56e626d72ffba0a50d6c992df0f5eb6a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a56e626d72ffba0a50d6c992df0f5eb6a">&#9670;&nbsp;</a></span>AxiEthernetResetDevice()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int AxiEthernetResetDevice </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function resets the device but preserves the options set by the user. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>-XST_SUCCESS if reset is successful -XST_FAILURE. if reset is not successful</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">References <a class="el" href="group__axiethernet__v5__0.html#gaa5b70a456ac18505132f61f596428ab7">XAxiEthernet_GetMacAddress()</a>, <a class="el" href="group__axiethernet__v5__0.html#gaf48b8f321b842bfb139b473ad7185874">XAxiEthernet_GetOptions()</a>, and <a class="el" href="group__axiethernet__v5__0.html#ga4e952a55f342f176ba9ec2b49e2e47cb">XAxiEthernet_Stop()</a>.</p>

</div>
</div>
<a id="afca56032499429904944d2fc83975c9f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afca56032499429904944d2fc83975c9f">&#9670;&nbsp;</a></span>AxiEthernetSingleFramePolledExample()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int AxiEthernetSingleFramePolledExample </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function demonstrates the usage of the Axi Ethernet by sending and receiving a single frame in polled mode. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>-XST_SUCCESS to indicate success -XST_FAILURE to indicate failure</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">References <a class="el" href="xaxiethernet__example_8h.html#a1eb6d3a3d578519d065f1e674d00f144">AxiEthernetUtilFrameHdrFormatMAC()</a>, and <a class="el" href="group__axiethernet__v5__0.html#ga2cfa48d42e55238f6f30aff6d658e4fe">XAxiEthernet_Start()</a>.</p>

</div>
</div>
<a id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">&#9670;&nbsp;</a></span>main()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This is the main function for the AxiEthernet example. </p>
<p>This function is not included if the example is generated from the TestAppGen test tool.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">None.</td><td></td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>-XST_SUCCESS to indicate success -XST_FAILURE to indicate failure</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p class="reference">References <a class="el" href="xaxiethernet__example__polled_8c.html#a827aa292a20f9a15e68bfe60e82cfc13">AxiEthernetPolledExample()</a>, and <a class="el" href="xaxiethernet__example_8h.html#ad700d3b9e292277d5437ecc4dc304dc3">AxiEthernetUtilErrorTrap()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
  </ul>
</div>
</body>
</html>
